<?php
/**
 * User: i@fedax.cn
 * Time: 2018/7/27 17:45
 */

namespace app\admin\model;

/**
 * 礼物碎片
 * Class GiftFrag
 * @package app\admin\model
 */
class GiftFrag extends DataBase
{
    protected $name = 'gift_frag';
    protected $autoWriteTimestamp = true;
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    public function getAddTimeAttr($value)
    {
        return date('Y-m-d H:i:s', $value);
    }

    /**
     * @param $page_config
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getDataList($page_config)
    {
        return $this
            ->view('ss_gift_frag', 'id,fragments_num,status,update_time')
            ->view('ss_gift_url', 'gift_name,diamonds', 'ss_gift_frag.gift_id = ss_gift_url.id')
            ->order('ss_gift_frag.id desc')
            ->paginate($page_config);
    }
}